
<script type="text/javascript">
    function deleteDepartment(id) {
        
        if (confirm("<?php echo lang('txt_delete_confirm'); ?>")) {
            window.location = "<?php echo base_url('department/delete'); ?>/" + id;
        }
       
    }
</script>
<div class="hastable">
					<form name="myform" class="pager-form" method="post" action="#">
						<table id="sort-table"> 
						<thead> 
						<tr>
						    <th>Tên phòng ban</th> 
                                                    <th style="width:132px">Lựa chọn</th> 
						</tr> 
						</thead> 
                                                <tbody> <?php $depart = new Department();?>
                                                    <?php while ($department->fetchNext()) { ?>
						<tr>
						    <td><?php echo getI18n($department->name); ?></td> 
						     <td>
                                                       
                                                        <a class="btn_no_text btn ui-state-default ui-corner-all tooltip" title="<?php echo lang('txt_edit'); ?>" href="<?php echo base_url('department/edit/'.$department->id); ?>">
                                                                <span class="ui-icon ui-icon-wrench"></span>
                                                        </a>
                                                         <?php if($department->id == 1 || $depart->hasUser($department->id) == true){?>
                                                        <a class="btn_no_text btn ui-state-default ui-corner-all tooltip" title="<?php echo lang('txt_delete'); ?>" href="#" onclick="deleteDepartment(<?php echo $department->id; ?>)">
                                                                <span class="ui-icon ui-icon-disabled ui-icon-circle-close"></span>
                                                        </a>
                                                         <?php }else{?>
                                                           <a class="btn_no_text btn ui-state-default ui-corner-all tooltip" title="<?php echo lang('txt_delete'); ?>" href="#" onclick="deleteDepartment(<?php echo $department->id; ?>)">
                                                                <span class="ui-icon ui-icon-disabled ui-icon-circle-close"></span>
                                                            </a>
                                                         <?php }?>
                                                    </td>
						</tr> 
						<?php } ?>
						
						</tbody>
						</table>
					
					</form>

					
				<?php echo $pagination->create_links();?>
				</div>